🔋 Battery Health Guide · Termux + KernelSU

Check Your Battery Health
on Xiaomi

A step-by-step beginner guide to reading real battery data from your rooted Android phone using Termux.

📱
Tested on
Xiaomi Mi 11X
KernelSU · Kernel 5.10.404R · MIUI/HyperOS
100%
Battery Health
4544
mAh (Current Max)
28.2°C
Temperature
257
Charge Cycles
01
What You Need Before Starting
📱
Rooted Phone
KernelSU or Magisk root access required
🖥️
Termux App
Install from F-Droid (not Play Store)
🔑
Root Permission
Allow Termux superuser access in KernelSU
📦
bc package
Math calculator — installed in this guide
⚠️
Download Termux from F-Droid only. The Play Store version is outdated and many commands won't work properly in it.
02
Install the bc Calculator

We need bc to do the health percentage math. Run this in Termux:

termux
pkg install bc
💡
Termux will ask "Do you want to continue? [Y/n]" — just press Y then Enter. It'll download and install automatically.
03
Find Your Battery's System Path

Android exposes battery data as files. First, list what power supply nodes exist on your device:

termux · root
su -c "ls /sys/class/power_supply/"

On the Mi 11X, the output looked like this:

Output
batt_verify   bms   main   usb
battery   bq2597x-standalone   pc_port
💡
Key finding: The default battery folder gave "Permission denied" errors on this device. The correct path was bms — which stands for Battery Management System.
04
Run the Full Battery Health Command

This single command reads all battery metrics and calculates health. Copy and paste the whole thing:

termux · root
su -c "sh -c ' # Battery Health Report echo \"=== Battery Health Report ===\" echo \"Charge Full: \$(cat /sys/class/power_supply/bms/charge_full) µAh\" echo \"Design Cap: \$(cat /sys/class/power_supply/bms/charge_full_design) µAh\" echo \"Capacity: \$(cat /sys/class/power_supply/bms/capacity)%\" echo \"Voltage: \$(cat /sys/class/power_supply/bms/voltage_now) µV\" echo \"Temp: \$(cat /sys/class/power_supply/bms/temp) (div 10 = °C)\" echo \"Cycle Count: \$(cat /sys/class/power_supply/bms/cycle_count)\" FULL=\$(cat /sys/class/power_supply/bms/charge_full) DESIGN=\$(cat /sys/class/power_supply/bms/charge_full_design) echo \"Health: \$(echo scale=2\; \$FULL / \$DESIGN \* 100 | bc)%\" '"
🔍
Why "sh -c"? Without wrapping in sh -c, the cat commands run as a normal user before root kicks in — causing "Permission denied". Wrapping ensures everything runs as root.
05
The Actual Output (Mi 11X)
=== Battery Health Report ===
Charge Full: 4544000 µAh
Design Cap: 4520000 µAh
Capacity: 53%
Voltage: 3846425 µV
Temp: 282 (div 10 = °C)
Cycle Count: 257
Health: 100.00%
06
What Every Number Means
Metric My Value What it means
charge_full 4544000 µAh Maximum charge your battery holds today = 4544 mAh (divide by 1000)
charge_full_design 4520000 µAh The original factory capacity = 4520 mAh. This is the reference for health %
capacity 53% Current charge level, like a fuel gauge. Was at 53% when command ran
voltage_now 3846425 µV Battery voltage = 3.85V. Normal range: 3.3V (empty) → 4.35V (full)
temp 282 Temperature in tenths of °C. So 282 ÷ 10 = 28.2°C. Safe range: <40°C
cycle_count 257 Number of full charge cycles completed. Batteries typically last 400–500 cycles before noticeable wear
Health % 100.00% (charge_full ÷ charge_full_design) × 100. Values >100% are normal for newer batteries
07
Your Battery Health Score
Battery Capacity Retained
0%
0%50%100%
🟢 Excellent — No Degradation Detected
257 charge cycles used · Estimated 143–243 cycles remaining before significant wear
Health RangeStatusWhat to do
95–100%+Excellent ✓Battery is like new. No action needed.
85–94%GoodNormal aging. Still performs well daily.
70–84%FairNoticeable battery drain. Consider usage habits.
Below 70%PoorTime to replace the battery.
08
Troubleshooting Common Errors
!
Permission denied on /sys/class/power_supply/battery/

The default battery folder may be restricted even with root on some kernels. This was the exact issue on the Mi 11X.

Fix: Use the bms path instead. First list available nodes:

termux
su -c "ls /sys/class/power_supply/"

Then replace battery with bms in all commands.

!
bc: command not found

The bc calculator isn't installed by default.

termux
pkg install bc

Or use awk as an alternative without installing anything:

termux
awk 'BEGIN {printf "Health: %.2f%%\n", (4544000/4520000)*100}'
!
Variables show blank (empty output)

This happens when you use su -c "echo $(cat ...)" — the subshell runs as normal user before root. Always wrap with sh -c '...' inside su.

wrong ❌
su -c "echo $(cat /sys/class/power_supply/bms/temp)"
correct ✓
su -c "sh -c 'echo \$(cat /sys/class/power_supply/bms/temp)'"